package xman.mssh.spring;

import javax.annotation.Resource;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import xman.mssh.spring.component.AppService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:spring/spring-conf.xml" })
public class SpringContextAnnotation {
    static Logger logger = LoggerFactory.getLogger(SpringContextAnnotation.class);
    
    @Resource
    private SpringBeanDemo springBeanDemo;
    
    @Resource
    private AppService appServcieImpl;
    
    @Test
    public void component() {
        appServcieImpl.invoke();
    }

    @Test
    public void outString() {
        springBeanDemo.outString();
        logger.info("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
        springBeanDemo.joinPointCut();
    }
    
    @BeforeClass
    public static void before() {
        if (logger.isDebugEnabled()) {
            logger.debug("--------------start----------------");
        }
    }
    
    @AfterClass
    public static void after() {
        if (logger.isDebugEnabled()) {
            logger.debug("---------------after---------------");
        }
    }
}
